#ifndef _DB_H_
#define _DB_H_

//Db.h

#include	<stdio.h>
#include	<string.h>
#include	<sys/types.h>
#include	<errno.h>
#include	<sys/stat.h>
#include	<fcntl.h>
#include	<unistd.h>
#include	<termios.h>
#include	<stdlib.h>
#include	<time.h>
#include	<unistd.h>



#include	"sqlite3.h"
#include	"common.h"
#include	"socket.h"

//*******************************************

#define	UPDATINTVAL	5		//Time Interval of updating the statistic Table

//*******************************************
enum TableName{
	INVTTBL,
	EVTTBL,
	FIXINVTTBL,
};

//*******************************************
//Interface
extern	int		Db_Init();
extern	int		Db_Update(struct PLC_Dat *pPLC_Dat_,int bUpdat_T_Statlist_,struct tm *pCur_time_);

extern	void	Db_Get_SocketDat();
extern	int		Db_Get_InvtAdr(unsigned long long int *pInvtAdr_);
extern	int		Db_Get_LcdkeyDat(struct Db2LcdKey* pDb2LcdKey_);

//Mis
extern	int		Db_Rdfstsettime();
extern	void	Db_Clrfstsetttime();
extern	int		Db_Rdfststartup();
extern	void	Db_Clrfststartup();
#endif
